<template>
  <div id="businesslist">  
    <el-form ref="form" :model="form" label-width="70px">  
     <el-row > 
        <el-col :span="24" style="display:flex;align-items: center;">
            <img class="top_img" src="@/assets/images/a8.png" style="width:35px;height:35px;margin-right:10px;"/>
            <div style="line-height: 40px;font-weight:bold:">详细列表</div>
        </el-col> 

    </el-row> 
     <el-row  style="display:flex;margin-top:10px;">
          <el-form-item label="手机号码" >
            <el-input v-model="form.account" placeholder="姓名/手机号" style="width:140px;"></el-input>
          </el-form-item>
          <el-form-item label="访问次数" style="margin-left:10px;">
            <el-input v-model="form.visit_count" placeholder="访问次数" style="width:140px;"></el-input>
          </el-form-item>
          <el-form-item label="访问任务" style="margin-left:10px;">
                <el-select  v-model="form.select_num" placeholder="用户类别" style="width:150px;">
                    <el-option  v-for="(item,index) in select_data" :key="index" :label="item.name" :value="item.id"></el-option>
                </el-select>
          </el-form-item>
          <div class="buttoon_box">
            <div class="buttoon_box_item"  style="margin-left:10px;background:#FFC600;color:white;" @click="search_but()">确 定</div>
            <div class="buttoon_box_item" style="margin-left:10px;border:1px solid #D9D9D9;" @click="sx_but()">清 空</div>    
         </div>      
    </el-row>
   
   </el-form>
   

    <business-list :datalist="datalist" @up_list_fun="list_fun"></business-list>        
    <div style="margin-top:20px;text-align: center;">
        <el-pagination
          background
          @current-change="handleCurrentChange"
          :page-size="10"  
          layout="prev, pager, next, jumper"
          :total="count">
        </el-pagination>
    </div>


  </div>
</template>

<script>
import BusinessList from '@/view/Aftersale/Business/BusinessList'
export default {
  name: 'businesslist',
  data () {
    return {
      datalist:[],
      page:1,
      count:0,
      form:{
         account:'',
         visit_count:'',
         select_num:0,
      },
      select_data:[{"id":0,"name":"全部"},{"id":1,"name":"当周访问"},{"id":2,"name":"当周未访问"}],
    }
  },
   components:{
      BusinessList,
  },
  created(){
       this.list_fun()
  },
  mounted (){
      
  },
  methods: {
    list_fun(){
        this.post("/business_management/listOfMemberData", {
              page:this.page,
              account:this.form.account,
              visit_count:this.form.visit_count,
              is_visit:this.form.select_num,
	         }).then(res => {
            this.count = res.result.count
            this.datalist = res.result.list                   
            console.log(res)
          })
    },
    search_but(){
        this.page = 1   
        this.list_fun()
    },
    sx_but(){
        this.page = 1
        this.form={
          account:'',
          visit_count:'',
          select_num:0,
         }
        this.list_fun()
    },
    handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
        this.page = val
        this.list_fun()
        console.log(`当前页: ${val}`);
    }
  }
}
</script>


<style scoped>
.see_but{
    width: 90px;
    height: 30px;
    background: #B3C0D1;
    border-radius: 18px;
    text-align: center;
    line-height: 30px;
    color:white;
    font-size: 14px;
    cursor: pointer;
}
.buttoon_box{
  display:flex;margin-bottom:10px;
}
.buttoon_box_item{
  height:40px;line-height:40px;width:60px;font-size:14px;text-align:center;border-radius:5px;
}
</style>
